package com.woniuxy.commons.interceptor.configuration;

import com.woniuxy.commons.interceptor.PermissionInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;

/**
 * <P> @Author: ideaAdmin
 * <P> TODO: Class
 * <P> TODO: 拦截器配置类 将拦截器添加到拦截器列表中 同时指定拦截哪些请求
 * <P> Date: 2022/3/30:15:14
 * <P> Description:
 */
@Configuration
public class PermissionInterceptorConfiguration implements WebMvcConfigurer {

    @Resource
    private PermissionInterceptor permissionInterceptor;


    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // 添加拦截器 拦截所有的请求
        registry.addInterceptor(permissionInterceptor).
                addPathPatterns("/**");
    }


}
